import store from '../../../../store'
import { change3Dtiles } from "assets/js/CesiumFun/CesiumPubFun/modelControl"

export default (scene, cameraPosition, cameraId) => {
    // 摄像头模型
    var tilesetcamera = scene.primitives.add(new Cesium.Cesium3DTileset({
        url: 'models/camera/tileset.json'
    }));
    new Promise((resolve, reject) => {
        change3Dtiles(tilesetcamera, cameraPosition.lon, cameraPosition.lat, cameraPosition.height, 0, 1, resolve)
    }).then((position) => {
        tilesetcamera.asset.extras.push({
            "type": "camera",
            "Id": cameraId,            // 相机id
            "Position": position,      // 相机位置
            "scale": 1,                // 相机模型大小
            "rotation": 0              // 相机当前角度
        })
        store.commit('addCamera', tilesetcamera)// vuex记录相机
    })
}